//
//  MyPerson.m
//  YiLiao
//
//  Created by mac on 16/7/1.
//  Copyright © 2016年 Noah. All rights reserved.
//

#import "MyPerson.h"
//#import "CustomTableViewCell.h"
#import "LoadViewController.h"

@interface MyPerson ()<UITableViewDataSource,UITableViewDelegate>
{
    
}
@property (nonatomic ,strong)UIImageView *imageView1;
@property (nonatomic ,strong)UITableView *tableView;
@end

@implementation MyPerson

-(UITableView *)tableView{
    if (!_tableView) {
        self.tableView=[[UITableView alloc]initWithFrame:CGRectMake(0, 60, kScreenWidth, kScreenHeight-60) style:UITableViewStyleGrouped];
        _tableView.delegate=self;
        _tableView.dataSource=self;
//        [_tableView registerNib:[UINib nibWithNibName:@"CustomTableViewCell" bundle:nil] forCellReuseIdentifier:@"cell"];
        [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
        
        
    }
    return _tableView;
}
-(UIImageView *)imageView1{
    if (!_imageView1) {
        self.imageView1=[[UIImageView alloc]initWithFrame:CGRectMake(kScreenWidth-120, 2, 75, 75)];
        _imageView1.layer.cornerRadius=37.5;
        _imageView1.layer.masksToBounds=YES;
    }
    return self.imageView1;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.tableView];
    self.title=@"个人中心";
    
    
}
//
//qu高
//-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
//    return  10;
//}

//返回行高
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section==0) {
        return 80;
    }
    return 40;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    switch (section) {
        case 0:
            return 1;
            break;
        case 1:
            return 3;
            break;
        case 2:
            return 1;
            break;
            
        default:
            break;
    }
    return 0;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 4;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    if (indexPath.section==0) {
        cell.textLabel.text=@"个人信息";
//        NSData *da
//        self.imageView1.image=[NSKeyedUnarchiver unarchiveObjectWithData:<#(nonnull NSData *)#>];
        
    }else if(indexPath.section==1){
        if (indexPath.row==0) {
            cell.textLabel.text=@"清理图片缓存(3.56M)";
        }else if(indexPath.row==1){
                cell.textLabel.text=@"清理文件缓存(356M)";
        }else{
                cell.textLabel.text=@"退出登录";
        }
    }else{
        cell.textLabel.text=@"关于我们";
    }
    
    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    LoadViewController *load=[[LoadViewController alloc]init];
    if (indexPath.section==0    ) {
       [self.navigationController pushViewController:load animated:YES];
    }
    
}

@end
